5 REM PRINT TAB(32);"CHECKERS"
10 REM PRINT TAB(15);"CREATIVE COMPUTING  MORRISTOWN, NEW JERSEY"
12 REM I reckon there still some suble bugs; some code is rather murky. :-(
14 REM J.L. Bezemer, 2011 - uBasic version
15 PRINT:PRINT:PRINT
20 PRINT "THIS IS THE GAME OF CHECKERS.  THE COMPUTER IS X,"
25 PRINT "AND YOU ARE O.  THE COMPUTER WILL MOVE FIRST."
30 PRINT "SQUARES ARE REFERRED TO BY A COORDINATE SYSTEM."
35 PRINT "(0,0) IS THE LOWER LEFT CORNER"
40 PRINT "(0,7) IS THE UPPER LEFT CORNER"
45 PRINT "(7,0) IS THE LOWER RIGHT CORNER"
50 PRINT "(7,7) IS THE UPPER RIGHT CORNER"
55 PRINT "THE COMPUTER WILL TYPE '+TO' WHEN YOU HAVE ANOTHER"
60 PRINT "JUMP. TYPE TWO NEGATIVE NUMBERS IF YOU CANNOT JUMP."
65 PRINT : PRINT : PRINT
80 REM DIM R(4),S(7,7):
90 G=-1 : @(70)=-99
100 REM 1,0,1,0,0,0,-1,0,0,1,0,0,0,-1,0,-1,15
120 FOR X=0 TO 3
130 @((X*16)+0)=1  : @((X*16)+1)=0   : @((X*16)+2)=1  : @((X*16)+3)=0
140 @((X*16)+4)=0  : @((X*16)+5)=0   : @((X*16)+6)=-1 : @((X*16)+7)=0
150 @((X*16)+8)=0  : @((X*16)+9)=1   : @((X*16)+10)=0 : @((X*16)+11)=0
160 @((X*16)+12)=0 : @((X*16)+13)=-1 : @((X*16)+14)=0 : @((X*16)+15)=-1
200 NEXT X
230 FOR X=0 TO 7 : FOR Y=0 TO 7 : IF @(X*8+Y)>-1 THEN GOTO 350
310 IF @(X*8+Y)=-1 THEN A=-1 : B=G : GOSUB 650 : A=1 : GOSUB 650
330 IF @(X*8+Y)=-2 THEN A=-1 : B=-1 : GOSUB 650 : B=1 : GOSUB 650 : A=1 : GOSUB 650 : B=-1 : GOSUB 650
350 NEXT Y : NEXT X : GOTO 1140
650 U=X+A : V=Y+B : IF (U<0)+(U>7)+(V<0)+(V>7) THEN GOTO 870
740 IF @(U*8+V)=0 THEN GOSUB 910 : GOTO 870
770 IF @(U*8+V)<0 THEN GOTO 870
790 U=U+A : V=V+B : IF (U<0)+(V<0)+(U>7)+(V>7) THEN GOTO 870
850 IF @(U*8+V)=0 THEN GOSUB 910
870 RETURN
910 IF (V=0)*(@(X*8+Y)=-1) THEN Q=Q+2
920 @(250) = Y-V : GOSUB 2000 : IF @(250)=2 THEN Q=Q+5
960 IF Y=7 THEN Q=Q-2
980 IF (U=0)+(U=7) THEN Q=Q+1
1030 FOR C=-1 TO 1 : IF (U+C<0)+(U+C>7)+(V+G<0) THEN GOTO 1080
1035 IF @((U+C)*8+(V+G))<0 THEN Q=Q+1: GOTO 1080
1040 IF (U-C<0)+(U-C>7)+(V-G>7) THEN GOTO 1080
1045 IF (@((U+C)*8+(V+G))>0)*(@((U-C)*8+(V-G))=0)+((U-C=X)*(V-G=Y)) THEN Q=Q-2
1080 C=C+1 : NEXT C : IF Q>@(70) THEN @(70)=Q : @(71)=X : @(72)=Y : @(73)=U : @(74)=V
1100 Q=0 : RETURN
1140 IF @(70)=-99 THEN GOTO 1880
1230 PRINT "FROM ";@(71);" ";@(72);" TO ";@(73);" ";@(74); : @(70)=-99
1240 IF @(74)=0 THEN @(@(73)*8+@(74))=-2 : GOTO 1420
1250 @(@(73)*8+@(74))=@(@(71)*8+@(72))
1310 @(@(71)*8+@(72))=0 : @(250)=@(71)-@(73) : GOSUB 2000 : IF @(250)#2 THEN GOTO 1420
1330 @(((@(71)+@(73))/2)*8+(@(72)+(@(74))/2))=0
1340 X=@(73) : Y=@(74) : IF @(X*8+Y)=-1 THEN B=-2 : A=-2 : GOSUB 1370 : A=2 : GOSUB 1370
1350 IF @(X*8+Y)=-2 THEN A=-2 : B=-2 : GOSUB 1370 : B=2 : GOSUB 1370 : A=2 : GOSUB 1370 : B=-2 : GOSUB 1370
1360 IF @(70)#-99 THEN PRINT "TO ";@(73);" ";@(74); : @(70)=-99 : GOTO 1240
1365 GOTO 1420
1370 U=X+A : V=Y+B : IF (U<0)+(U>7)+(V<0)+(V>7) THEN GOTO 1400
1380 IF (@(U*8+V)=0)*(@((X+A/2)*8+(Y+B/2))>0) THEN GOSUB 910
1400 RETURN
1420 PRINT : PRINT : PRINT : FOR Y=0 TO 7 : PRINT 7-Y;"|"; : FOR X=0 TO 7
1425 PRINT " ";
1427 REM PRINT @(X*8+(7-Y)), X*8+(7-Y), 5*X
1430 IF @(X*8+(7-Y))=0  THEN PRINT ". ";
1470 IF @(X*8+(7-Y))=1  THEN PRINT "O ";
1490 IF @(X*8+(7-Y))=-1 THEN PRINT "X ";
1510 IF @(X*8+(7-Y))=-2 THEN PRINT "X*";
1530 IF @(X*8+(7-Y))=2  THEN PRINT "O*";
1540 IF (@(X*8+(7-Y))<-2)+(@(X*8+(7-Y))>2) THEN PRINT "??";
1550 NEXT X : PRINT :  NEXT Y
1554 PRINT "   ----------------------"
1555 PRINT "   0  1  2  3  4  5  6  7" : PRINT
1556 FOR L=0 TO 7
1557 FOR M=0 TO 7
1558 IF (@(L*8+M)=1)+(@(L*8+M)=2) THEN Z=1
1559 IF (@(L*8+M)=-1)+(@(L*8+M)=-2) THEN T=1
1560 NEXT M
1562 NEXT L
1564 IF Z#1 THEN GOTO 1885
1566 IF T#1 THEN GOTO 1880
1570 Z=0 : T=0
1590 PRINT "FROM:" : INPUT E : INPUT H : X=E : Y=H
1600 IF (E<0) +(E>7)+(H<0)+(H>7) THEN GOTO 1590
1610 IF @(X*8+Y)<1 THEN GOTO 1590
1620 PRINT "TO:" : INPUT A : INPUT B : X=A : Y=B
1630 IF (A<0) +(A>7)+(B<0)+(B>7) THEN GOTO 1590
1640 @(250)=A-E : GOSUB 2000 : @(251)=@(250) : @(250)=B-H : GOSUB 2000
1680 IF (@(X*8+Y)=0)*(@(251)<3)*(@(251)=@(250)) THEN GOTO 1700
1690 PRINT : GOTO 1620
1700 I=46
1750 @(A*8+B)=@(E*8+H) : @(E*8+H)=0 : @(250)=E-A : GOSUB 2000 : IF @(250)#2 THEN GOTO 1810
1800 @(((E+A)/2)*8+((H+B)/2))=0
1802 PRINT "+TO:" : INPUT O : @(100)=O : INPUT O : @(101)=O : IF @(100)<0 THEN GOTO 1810
1803 @(250)=@(100)-A : GOSUB 2000 : @(251)=@(250) : @(250)=@(101)-B : GOSUB 2000
1804 IF (@(@(100)*8+@(101))#0)+(@(251)#2)+(@(250)#2) THEN GOTO 1802
1806 E=A : H=B : A=@(100) : B=@(101) : I=I+15 : GOTO 1750
1810 IF B=7 THEN @(A*8+B)=2
1830 GOTO 230
1880 PRINT : PRINT "YOU WIN." : END
1885 PRINT : PRINT "I WIN." : END
2000 IF @(250)<0 THEN @(250)=-@(250)
2010 RETURN